//
//  SearchViewController.m
//  BestPriceApp
//
//  Created by You50029 on 2014-03-28.
//  Copyright (c) 2014 AresSystems. All rights reserved.
//

#import "SearchViewController.h"
#import "StoreTableViewController.h"

@interface SearchViewController ()

@end

@implementation SearchViewController

@synthesize searchText;

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"search"]) {
        
        UINavigationController *navController = (UINavigationController*)[segue destinationViewController];
        StoreTableViewController *store = [navController topViewController];

        
        //StoreTableViewController *store = segue.destinationViewController;
        store.searchString = self.searchText.text;
    }
}

- (void)viewDidLoad
{
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
                                   initWithTarget:(self) action:@selector(dismissKeyboard)];
    [self.view addGestureRecognizer:tap];
    
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)dismissKeyboard
{
    [searchText resignFirstResponder];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction) editingEnded:(id)sender
{
    [sender resignFirstResponder];
}

@end
